/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package manager;

import entity.Department;
import java.util.ArrayList;

/**
 *
 * @author NgocNam
 */
public class managerDepartment {
     ArrayList<Department> list;

    public managerDepartment() {
        list = new ArrayList<Department>();
    }

    public void addDepartment(Department d) {
        list.add(d);
    }

    public void addDepartment(ArrayList<Department> list) {
        this.list.addAll(list);
    }

    public void removeDepartment(Department d) {
        this.list.remove(d);
    }
    

    public void updateDepartment(Department d) {
        for (int i = 0; i < this.list.size(); i++) {
            if (list.get(i).getDepartmentID() == d.getDepartmentID()) {
                list.set(i, d);
            }
        }

    }

    public Department getDepartment(int index) {
       return  this.list.get(index);
    }

    public int getSize() {
        return list.size();
    }
}
